package com.hd123.rumba.util.lunar;

public class ChineseEra {
  int iYear;
  private static String[] sHeavenlyStems = {
      "甲", "乙", "丙", "丁", "戊", "己", "庚", "辛", "壬", "癸" };
  private static String[] sEarthlyBranches = {
      "子", "丑", "寅", "卯", "辰", "巳", "午", "未", "申", "酉", "戌", "亥" };

  public ChineseEra() {
    iYear = 1981;
  }

  public ChineseEra(int iYear) {
    if ((iYear < 2050) && (iYear > 1901))
      this.iYear = iYear;
    else
      this.iYear = 1981;
  }

  public String toString() {
    int temp;
    temp = Math.abs(iYear - 1924);
    return sHeavenlyStems[temp % 10] + sEarthlyBranches[temp % 12];
  }
}
